import { FormProps, FormSchema } from '@/components/Table'
import { BasicColumn } from '@/components/Table/src/types/table'

// 角色列表
export function getRoleBasicColumns(): BasicColumn[] {
  return [
    {
      title: '角色名称',
      dataIndex: 'roleName'
    },
    {
      title: '角色说明',
      customEllipsis: true,
      width: 320,
      dataIndex: 'roleDescribe'
    },
    {
      title: '用户数量',
      width: 80,
      align: 'right',
      dataIndex: 'userNumber'
    },
    {
      title: '创建时间',
      dataIndex: 'createDate'
    },
    {
      title: '操作',
      width: 144,
      align: 'left',
      dataIndex: 'operate'
    }
  ]
}

export function getSearchFormConfig(): Partial<FormProps> {
  return {
    labelWidth: 80,
    baseColProps: {
      span: 6,
      md: 10,
      xl: 8,
      xxl: 6
    },
    schemas: [
      {
        field: 'roleName',
        label: '角色名称',
        component: 'Input'
      }
    ]
  }
}
// 角色信息表单
export function getRoleFormConfig(): Partial<FormProps> {
  return {
    layout: 'vertical',
    showActionButtonGroup: false,
    baseColProps: {
      span: 24,
      style: {
        marginBottom: '4px'
      }
    },
    schemas: [
      {
        field: 'roleName',
        component: 'Input',
        label: '角色名称',
        required: true
      },
      {
        field: 'roleDescribe',
        component: 'InputTextArea',
        label: '角色描述',
        componentProps: {
          autoSize: { minRows: 3, maxRows: 3 },
          maxLength: 30,
          placeholder: '请输入角色描述，中文30字以内'
        }
      }
    ]
  }
}
// 角色用户列表
export function getRoleUserBasicColumns(): BasicColumn[] {
  return [
    {
      title: '用户名',
      dataIndex: 'userAccount'
    },
    {
      title: '姓名',
      dataIndex: 'userName'
    },
    {
      title: '手机号',
      dataIndex: 'phoneNumber'
    },
    {
      title: '邮箱',
      dataIndex: 'email'
    }
  ]
}
